﻿using System;
using OpenCvSharp;

namespace RipDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Mat img = Cv2.ImRead(@"E:\TestImgAndPdf\cmyk4.tif");
                Mat[] imgColorArr = Cv2.Split(img);
                //imgColorArr[0] = new Mat();
                //imgColorArr[1] = new Mat();
                //Mat result = new Mat();
                Mat c = imgColorArr[0];
                //Mat g = imgColorArr[1];
                //Mat b = imgColorArr[0];
                //Cv2.Merge(imgColorArr, r);
                Cv2.ImWrite(@"c1.TIF", c);
                Mat m = imgColorArr[1];
                Cv2.ImWrite(@"m1.TIF", m);
                Mat y = imgColorArr[2];
                Cv2.ImWrite(@"y1.TIF", y);
                Mat k = imgColorArr[3];
                Cv2.ImWrite(@"k1.TIF", k);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            
        }


    }
}
